package com.my.biao.util;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

import java.util.List;

/**
 * 项目名称：检查所需App 是否安装了
 * 创建人：mwb
 * 创建时间：2018/10/18 9:58
 */
public class CheckAppInstall {

    /**
     * app 包名
     *
     * @param var1        context
     * @param packageName 目标app包名
     * @return
     */
    public static boolean checkApp(Context var1, String packageName) {
        PackageManager var2 = var1.getPackageManager();
        List var3 = var2.getInstalledPackages(0);
        if (var3 != null) {
            for (int var4 = 0; var4 < var3.size(); var4++) {
                String var5 = ((PackageInfo) var3.get(var4)).packageName;
                if (var5.equals(packageName)) {
                    return true;
                }
            }
        }
        return false;
    }

}
